function copySorted(arr) {
    let newArr = [];
    for (let num of arr) {
        newArr.push(num);
    }
    newArr.sort();
    return newArr;
}

let arr = ["HTML", "JavaScript", "CSS"];

let sorted = copySorted(arr);

alert(arr);
alert(sorted);